using System;
using System.ComponentModel.DataAnnotations;
using InfoTech.VinhSon.Bussiness;

namespace InfoTech.VinhSon.Models
{
	[Serializable]
	public partial class ArticleGroupModel
	{

		#region Constructor

		public ArticleGroupModel()
		{
		}

		public ArticleGroupModel(ArticleGroup value)
		{
			Id = value.Id;
			if(value.Article != null)
				ArticleId = value.Article.Id;
			if(value.Group != null)
				GroupId = value.Group.Id;
			FromDate = value.FromDate;
			ToDate = value.ToDate;
		}

		#endregion

		#region Fields

		private System.Int32 _Id;

		private System.Int32? _ArticleId;

		private System.Int32? _GroupId;

		private System.DateTime? _FromDate;

		private System.DateTime? _ToDate;

		#endregion

		#region Properties

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32 Id
		{
			get
			{
				return _Id;
			}
			set
			{
				_Id = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? ArticleId
		{
			get
			{
				return _ArticleId;
			}
			set
			{
				_ArticleId = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? GroupId
		{
			get
			{
				return _GroupId;
			}
			set
			{
				_GroupId = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.DateTime? FromDate
		{
			get
			{
				return _FromDate;
			}
			set
			{
				_FromDate = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.DateTime? ToDate
		{
			get
			{
				return _ToDate;
			}
			set
			{
				_ToDate = value;
			}
		}

		#endregion

		#region Operators

		public void Update(ArticleGroup value)
		{
			// value.Id = Id;
			value.FromDate = FromDate;
			value.ToDate = ToDate;
		}

		public static implicit operator ArticleGroupModel(ArticleGroup obj)
		{
			return new ArticleGroupModel(obj);
		}

		public static implicit operator ArticleGroup(ArticleGroupModel obj)
		{
			ArticleGroup value = new ArticleGroup();
			obj.Update(value);
			return value;
		}

		#endregion

	}
}
